<template>
  <div class="adminBox">
    <el-container>
      <el-aside width="250px">
        <el-menu
            background-color=rgba(100,100,100,0.5) text-color="#fff" active-text-color="#333"
            default-active="-1"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose">


          <el-menu-item index="-1" class="title" @click="toHome">
            <i class="el-icon-menu" ></i>
            <span slot="title" >首页</span>
          </el-menu-item>

          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>我的班级</span>
            </template>
              <el-menu-item index="1-1" @click="toOurClass">班级风采</el-menu-item>
              <el-menu-item index="1-2" @click="toStudents">学生管理</el-menu-item>
              <el-menu-item index="1-3" @click="toCollRoll">班级点名</el-menu-item>
            <el-menu-item index="1-4" @click="toStuData">学生数据</el-menu-item>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>课程表</span>
            </template>
            <el-menu-item index="2-1">一班</el-menu-item>
            <el-menu-item index="2-2">二班</el-menu-item>
            <el-menu-item index="2-3">三班</el-menu-item>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>我的资源</span>
            </template>
            <el-menu-item index="3-1">成长档案</el-menu-item>
            <el-menu-item index="3-2">家校沟通</el-menu-item>
            <el-menu-item index="3-3">讨论区</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header height="100px">HELLO</el-header>
        <el-main>
          <router-view/>
        </el-main>
        <el-footer height="150px"> Footer</el-footer>
      </el-container>
    </el-container>
  </div>

</template>

<script>
import {login} from "../../Api/User.js";

export default {
  name: "admin",
  data() {
    return {

    }
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    safeReplace(targetPath) {
      if (this.$route.path !== targetPath) {
        this.$router.replace(targetPath);
      }
    },
    toOurClass(){
      this.safeReplace('/admin/ourclass')
    },
    toHome(){
      this.safeReplace('/admin')
    },
    toStudents(){
      this.safeReplace('/admin/students')
    },
    toCollRoll(){
      this.safeReplace('/admin/collroll')
    },
    toStuData(){
      this.safeReplace('/admin/studentsData')
    },
  }
}
</script>

<style scoped>

.adminBox{
  background-image: url(../../public/灰原哀.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  border-radius: 20px;

}

.el-header, .el-footer {
  background-color: rgba(200,200,200,0.5);
  backdrop-filter: blur(5px);
  color: #fff;
  height: 100vh;
  font-family: "楷体";
  text-align: center;
  line-height: 60px;
  text-shadow: 0 0 2px #fff;

}
.el-header{
  font-size: 30px;
  border-top-right-radius: 20px;
}
.el-footer{
  border-bottom-right-radius: 20px;
}

.el-aside {
  background-color: rgba(100,100,100,0.5);
  text-align: center;
  line-height: 60px;
  color: #fff;
  font-family: "楷体";
  text-shadow: 0 0 2px #fff;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  backdrop-filter: blur(5px);
  height: 120vh;
}

.el-main {
  background-color: rgba(255,255,255,0.5);
  font-family: "楷体";
  text-shadow: 0 0 2px #fff;
  text-align: center;
  height: 60vh;
}

body > .el-container {
  margin-bottom: 40px;

}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.title{
  font-size: 20px;
  font-weight: bold;
  font-family: "楷体";
  text-shadow: 0 0 5px #fff;
  text-align: center;
  line-height: 100px;
  height: 100px;
}


</style>